package com.week2.zuhe;

public class MyTriangle 
{
	private MyPoint v1;
	private MyPoint v2;
	private MyPoint v3;
	
	public MyTriangle(int x1,int y1,int x2,int y2,int x3,int y3)
	{
		v1 = new MyPoint(x1,y1);
		v2 = new MyPoint(x2,y2);
		v3 = new MyPoint(x3,y3);
	}
	public MyTriangle(MyPoint v1,MyPoint v2,MyPoint v3)
	{
		this.v1 = v1;
		this.v2 = v2;
		this.v3 = v3;
	}
	public String toString()
	{
		return "MyTriangle[v1="+v1.toString()+",v2="+v2.toString()+",v3="+v3.toString()+"]";
	}
	public double getPerimeter()
	{
		return v1.distance(v2.getX(),v2.getY())+v1.distance(v3.getX(),v3.getY())
		       +v2.distance(v3.getX(),v3.getY());
	}
	public String getType()
	{
		double a1 = v1.distance(v2.getX(),v2.getY());
		double a2 = v1.distance(v3.getX(),v3.getY());
		double a3 = v2.distance(v3.getX(),v3.getY());
		if(a1==a2&&a1==a3)
		{
			return  "Equilateral";
		}else if(a1==a2||a1==a3||a2==a3)
		{
			return "Isosceles";
		}else
		{
			return "Scalene";
		}

	}

}
